HomeAxis

命令轴执行"寻找原点"序列。Position 输入用来在侦测到索引信号时设定绝对位置,若此函式在 Standstill 开始,则在 Standstill 完成。

语法

KsCommandStatus HomeAxis(
     int Index,
     double Position,
     double Velocity,
     double EndVelocity,
     double Acceleration,
     double Deceleration,
     double Jerk,
     McDirection Direction,
     McHomingMode HomingMode
);

参数

Index [in]:轴索引。索引以零为起点;别名将影响此参数。

Position [in]:在侦测到索引信号时设定绝对位置,[单位]。

Velocity [in]:原点复归移动的开始速度。

EndVelocity [in]:原点复归移动的结速速度,使用方式依原点复归模式而定。

Acceleration [in]:加速度值。

Deceleration [in]:减速度值。

Jerk [in]:加加速度值。

Direction [in]:轴移动至原点的方向,使用 McDirection 类型之 0、2 或 3。

HomingMode [in]:选择原点复归模式,请见 McHomingMode 类型。

回传值

返回 KsCommandStatus 结构。

备注

范例

VOID HomeLatch(INT Index) {
   //Configure the probe to use for position latching
   /*The axis will move in the preset homing direction at the high velocity
     until the probe is triggered*/
   //The axis will then move back to the latched position using the low velocity
   double PosRecord = 0;
   McProbeTrigger ProbeTrigger = { 0 };
   ProbeTrigger.TouchProbeId = 0;
   ProbeTrigger.IndexPulse = TRUE;
   ProbeTrigger.Edge = TRUE;
   KsCommandStatus probe = SetAxisTouchProbe(Index, ProbeTrigger, FALSE, 0, 0, &PosRecord);

   //Start Homing
   KsCommandStatus home = WaitForCommand(30, TRUE, HomeAxis(Index, 0, 360, 36,
	 3600, 3600, 3600000, mcPositiveDirection, homingLatch));

   double homePosition = 1;
   GetAxisPosition(Index, mcActualValue, &homePosition);
   RtPrintf("Home position: %d\n", (int)homePosition);
}

使用需求

  RT Win32
最低支援版本 4.0 4.0
标头档 ksmotion.h ksmotion.h
程式库 KsApi_Rtss.lib KsApi.lib

参见

HaltAxis

StopAxis